/* -----------------------------------------------------------------------
 * Card Test 1 = Testing Smithy
 * Using provided template for testUpdateCoins.c
 *
 * -----------------------------------------------------------------------
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"
#include <stdlib.h>

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

void testSmithy() {
    //Game setup
    int seed = 1000;
    int numPlayer = 2;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    initializeGame(numPlayer, k, seed, &G);

    //Card effect setup
    int card = smithy;
    int choice1 = 0;
    int choice2 = 0;
    int choice3 = 0; 
    int handPos = 1;
    //Bonus setup, irrelevant to test
    int b = 0;
    int *bonus;
    bonus = &b;

    
    printf ("TESTING playing 'smithy':\n");

    int initHand = G.handCount[0];
#if (NOISY_TEST == 1)
    printf("Test player %d prior to playing smithy has %d hand card(s). %d cards expected.\n", 0, G.handCount[0], initHand);
#endif
    assert(G.handCount[0] == initHand);
    //Play smithy card
    cardEffect(card, choice1, choice2, choice3, &G, handPos, bonus);

#if (NOISY_TEST == 1)
    printf("Test player %d after playing smithy has %d hand card(s). %d cards expected.\n", 0, G.handCount[0], initHand + 2);
#endif
    assert(G.handCount[0] == initHand + 2); //+3 add card, -1 play card 
    assert(G.playedCardCount == 1); //1 card should have been played

    printf("All tests passed!\n");
}



int main() {
    testSmithy();
    return 0;
}
